# ##############################################################################
# drivers/ETH/MAC/Tricore/CMakeLists.txt
#
# Copyright (c) 2025 Li Auto Inc. and its affiliates
# Licensed under the Apache License, Version 2.0(the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#     http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# ##############################################################################
set(ETH_STACK_TC3xx_GETHMAC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/TC3xx" CACHE PATH "Path from drivers/Eth_GethMac")

set(ETHGETHMAC_INC)
set(ETHGETHMAC_SRCS)

list(APPEND ETHGETHMAC_INC
    ${NUTTX_DIR}/../../components/include/autosar
    ${NUTTX_APPS_DIR}/${APPS_DIR}/apps/
    ${NUTTX_DIR}/../../components/rt_framework/inc/
    ${NUTTX_DIR}/../../components/include/
)

if(CONFIG_MAC_TC3XX)
    nuttx_add_library(eth_gethmac STATIC)

    list(APPEND ETHGETHMAC_INC
        ${ETH_STACK_TC3xx_GETHMAC_DIR}
        ${VENDOR_THIRD_PARTY_DRIVER_INCDIR}
    )

    file(GLOB_RECURSE ETHGETHMACSRCS
        ${ETH_STACK_TC3xx_GETHMAC_DIR}/*.c
    )

    list(APPEND ETHGETHMAC_SRCS
        ${ETHGETHMACSRCS}
    )

    target_include_directories(eth_gethmac PUBLIC ${ETHGETHMAC_INC})
    target_sources(eth_gethmac PUBLIC ${ETHGETHMAC_SRCS})
    target_link_libraries(eth_gethmac PUBLIC eth_gethphy)
endif()
